﻿/*
    Function: Zeus Dialog
    Author:   Master HaKu
    Date:     2012/08/28
*/

//Callback Function of Confirm Dialog
var ZeusConfirmCallback = {
    confirmCallback: function () {

    }
}

/*
    Confirm Dialog
*/

function ZeusConfirmDialog(id, title, msg, type) {
    this.boxId = id;
    this.boxTitle = title;
    this.boxMsg = msg;
    this.boxUI = "<div id='" + this.boxId + "' title='" + this.boxTitle + "'>"
                + "<center><div class='dialog_content'>" + this.boxMsg + "</div></center></div>";
    this.boxType = type;
}

ZeusConfirmDialog.prototype.Init = function () {
    $(this.boxUI).appendTo("body");

    var box_height = 200;
    var box_width = 250;

    switch (this.boxType) {
        case "small":
            box_height = 200;
            box_width = 250;
            break;
        case "medium":
            box_height = 300;
            box_width = 400;
            break;
        case "large":
            box_height = 600;
            box_width = 800;
            break;
        default:
            box_height = 200;
            box_width = 250;
    }

    $("#" + this.boxId).dialog({
        autoOpen: false,
        height: box_height,
        width: box_width,
        modal: true,
        buttons: {
            "Yes": function () {
                ZeusConfirmCallback.confirmCallback();

                $(this).dialog("close");
            },
            "No": function () {
                $(this).dialog("close");
            }
        }
    });
}

ZeusConfirmDialog.prototype.Show = function () {
    $("#" + this.boxId).dialog("open");
}


/*
    Simple Dialog
*/

function ZeusSimpleDialog(id, title, msg, type) {
    this.boxId = id;
    this.boxTitle = title;
    this.boxMsg = msg;
    this.boxUI = "<div id='" + this.boxId + "' title='" + this.boxTitle + "'>"
                + "<div class='dialog_content'>" + this.boxMsg + "</div></div>";
    this.boxType = type;
}

ZeusSimpleDialog.prototype.Init = function () {
    $(this.boxUI).appendTo("body");

    var box_height = 200;
    var box_width = 250;

    switch (this.boxType) {
        case "small":
            box_height = 200;
            box_width = 250;
            break;
        case "medium":
            box_height = 300;
            box_width = 400;
            break;
        case "large":
            box_height = 600;
            box_width = 800;
            break;
        default:
            box_height = 200;
            box_width = 250;
    }

    $("#" + this.boxId).dialog({
        autoOpen: false,
        height: box_height,
        width: box_width,
        modal: true,
        //show: 'slideDown',
        hide: { 
            effect: 'explode', 
            delay: 250, 
            duration: 500, 
            easing: 'easeInQuad' 
        },
        buttons: {
            "Ok": function () {
                $(this).dialog("close");
            }
        }
    });
}

ZeusSimpleDialog.prototype.Show = function () {
    $("#" + this.boxId).dialog("open");
}


/*
    Content Dialog
*/

function ZeusContentDialog(id, title, contentId, type) {
    this.boxId = id;
    this.boxTitle = title;
    this.contentId = contentId;
    this.boxUI = "<div id='" + this.boxId + "' title='" + this.boxTitle + "'>"
                + "<div id='" + this.contentId + "' class='dialog_content'></div></div>";
    this.boxType = type;
}

ZeusContentDialog.prototype.Init = function () {
    $(this.boxUI).appendTo("body");

    var box_height = 580;
    var box_width = 660;

    switch (this.boxType) {
        case "medium":
            box_height = 580;
            box_width = 660;
            break;
        case "large":
            box_height = 750;
            box_width = 1000;
            break;
        default:
            box_height = 580;
            box_width = 660;
    }

    $("#" + this.boxId).dialog({
        autoOpen: false,
        height: box_height,
        width: box_width,
        modal: true,
        buttons: {

        }
    });
}

ZeusContentDialog.prototype.LoadContent = function (url) {
    var contId = this.contentId;

    $.get(url, function (data) {
        //alert("Show Content Url: " + url);

        $("#" + contId).html(data);
    });
}

ZeusContentDialog.prototype.Show = function () {
    $("#" + this.boxId).dialog("open");
}
